<div class="image" id="<?php echo $data->id; ?>">
    <a class="image-big-size" href="<?php echo Yii::app()->createUrl('site/viewphoto', array('id' => $data->id)); ?>">
        <img src="server/php/files/<?php echo $data->id; ?>.jpeg" />
    </a>
    <div class="image-info">
        <span class="image-name"><?php echo $data->ten_hinh; ?></span>
        <span class="like"><?php echo count($data->hinhLikes); ?> Thích | </span>
        <span class="comment"><?php echo count($data->binhLuanHinhs); ?> bình luận</span>
        <br />
        <span class="image-descrip"><?php echo $data->mo_ta; ?>&nbsp;</span>
        
        <?PHP 
        $HinhTag = HinhTag::model()->findAllByAttributes(array('id_hinh'=>$data->id));
        if($HinhTag!=null) echo "<br /><br />";
        foreach($HinhTag as $row_HinhTag)
        {
            $TagObj = Tag::model()->findByPk($row_HinhTag['id_tag']);
            
            if($TagObj!=null) echo '<span class="button_tag"><a href="index.php?r=site/explore&key='.$TagObj->ten_tag.'" title="Tìm kiếm các ảnh có tag '.$TagObj->ten_tag.'">'.$TagObj->ten_tag.'</a></span>';
        }
        ?>
    </div>
</div>